Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add idle timeout #118

Merged
merged 3 commits into from
Nov 19, 2024
Merged

add idle timeout #118

merged 3 commits into from
Nov 19, 2024

Conversation

Tianhao-Gu
Copy link
Collaborator

No description provided.

Copy link

codecov bot commented Nov 18, 2024

Codecov Report

Attention: Patch coverage is 19.04762% with 17 lines in your changes missing coverage. Please review.

Project coverage is 41.94%. Comparing base (3b2b59a) to head (1f805b6).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/jupyterhub_config/custom_docker_spawner.py 19.04% 17 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #118      +/-   ##
==========================================
- Coverage   42.94%   41.94%   -1.00%     
==========================================
  Files           7        7              
  Lines         482      503      +21     
==========================================
+ Hits          207      211       +4     
- Misses        275      292      +17     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

src/jupyterhub_config/custom_docker_spawner.py Outdated Show resolved Hide resolved
# Container has already stopped, return its status code immediately
return status

last_activity = self.user.last_activity
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this must be running in the central hub server since it's polling against possibly stopped containers. Is there a CustomDockerSpawner instance per user?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea. each user will have a spawner instance.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

self.log.info(f"Last activity for {self.container_name}: {last_activity}")

if last_activity:
idle_time = datetime.utcnow() - last_activity
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure timezone info isn't necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, both utcnow() and now() are working as expected locally. last_activity = self.user.last_activity doesn't have timezone info either.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Tianhao-Gu Tianhao-Gu merged commit 32d4d87 into main Nov 19, 2024
7 of 10 checks passed
@Tianhao-Gu Tianhao-Gu deleted the dev_jupyterhub branch November 19, 2024 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants